package com.chao.yyks.util;

import com.chao.common.util.DateUtile;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class test {

    public static String yh_tmp_1_today_event = "INSERT INTO yh_tmp_1_today_event (projectId, statisticDate, onSignNum, offSignNum, planOrderCount, defultOrderCount, woCount, woIssueCount, outMaterielStockNum, inMaterielStockNum, machineryCount) VALUES ('%s', '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0);";
    public static String yh_tmp_2_attendance = "INSERT INTO yh_tmp_2_attendance (projectId, statisticDate, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, attendanceList) VALUES ('%s', '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '[]');";
    public static String yh_tmp_3_work_order = "INSERT INTO yh_tmp_3_work_order (projectId, statisticDate, planOrderCount, defultOrderCount, completeOrderCount, unCompleteOrderCount, workOrderMap, avgHandleTime) VALUES ('%s', '%s', 0, 0, 0, 0, '{}', '0分钟');";
    public static String yh_tmp_4_wo = "INSERT INTO yh_tmp_4_wo (projectId, statisticDate, pointCount, completePointCount, unCompletePointCount, issueCount, completeIssueCount, unCompletePointList, issueList) VALUES ('%s', '%s', 0, 0, 0, 1, 0, '[]', '[]');";
    public static String yh_tmp_5_wo_materiel = "INSERT INTO yh_tmp_5_wo_materiel (projectId, statisticDate, inMaterielNum, inMaterielStockNum, outMaterielNum, outMaterielStockNum, inMaterialTypeMap, inMaterialTypeList, outMaterialTypeMap, outMaterialTypeList) VALUES ('%s', '%s', 0, 0, 0, 0, '{}', '[]', '{}', '[]');";

    private static Map<String, String> projectMap = new HashMap(){{
        //生产
        put("20221116145623056753", "20230926132650994522");
        put("20210902143748847594", "20230927162602540680");
        put("20230805155000278218", "20230926132309048713");

        //测试
//        put("20230805155000278218", "20211211103012680228");
//        put("20221116145623056753", "20230703144747726369");
    }};

    public static void main(String[] args) {

            projectMap.forEach((k,v) -> {
                for (int i = 0; i < 20; i++) {
                    System.out.println(String.format(yh_tmp_1_today_event, v, DateUtile.toYmd(DateUtile.editD(new Date(), i))));
                    System.out.println(String.format(yh_tmp_2_attendance, v, DateUtile.toYmd(DateUtile.editD(new Date(), i))));
                    System.out.println(String.format(yh_tmp_3_work_order, v, DateUtile.toYmd(DateUtile.editD(new Date(), i))));
                    System.out.println(String.format(yh_tmp_4_wo, v, DateUtile.toYmd(DateUtile.editD(new Date(), i))));
                    System.out.println(String.format(yh_tmp_5_wo_materiel, v, DateUtile.toYmd(DateUtile.editD(new Date(), i))));
                }
            });

    }
}
